package com.example.fraud;

import com.example.client.FraudReviewResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/api/v1")
public class FraudReviewController {

    private final FraudReviewService fraudReviewService;

    public FraudReviewController(FraudReviewService fraudReviewService) {
        this.fraudReviewService = fraudReviewService;
    }

    @GetMapping("/fraud-check/{email}")
    public FraudReviewResponse isFraudster(@PathVariable String email) {
        log.info("=== Fraud服务被调用，检查邮箱: {} ===", email);

        Boolean isFraud = fraudReviewService.isFraudulentCustomer(email);
        log.info("征信检查结果: {}", isFraud);

        return new FraudReviewResponse(isFraud);
    }
}